<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="./bootstrap/bootstrap.min.css"/>
  <link rel="stylesheet" href="./bootstrap/bootstrap-icons.css"/>
</head>
<body>
  <!-- 第一个需要一个class toast类 -->
  <div id="box" class="toast">这是一个轻提示</div>
  <style>
    #box{
      margin: 10px auto;
      background: rgba(0, 0, 0, 0.8);
      color: #fff;
      padding: 10px 10px;
    }
  </style>
  <script src="./bootstrap/bootstrap.min.js"></script>

  <script>
    let toastBox = document.querySelector('#box')
    // new bootstrap.Toast(dom对象, options)
    let toast = new bootstrap.Toast(toastBox,{
      animation:true,//开启过渡动画
      autohide:true,//开启自动隐藏
      delay:5000 //时间
    })
    toast.show()
  </script>
</body>
</html>